home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 66
/
Vol 66.iso
/
games
/
doodle_d.swf
/
scripts
/
DefineSprite_31_en10
/
frame_1
/
DoAction.as
Wrap
Text File
|
2013-04-24
|
2KB
|
68 lines
function onEnterFrame()
{
if(_root.shieldMC.hitTest(_X,_Y,true) && _root.shieldLevel >= 2)
{
dx = 0;
dy = 0;
}
distance = Math.sqrt((_X - _root.ship._x) * (_X - _root.ship._x) + (_Y - _root.ship._y) * (_Y - _root.ship._y));
if(distance < 300)
{
if(_X > 0 && _X < 640 && _Y < 880 && _Y > 0)
{
fx = _X - _root.ship._x + 1e-13;
fy = _Y - _root.ship._y;
radians = Math.atan(fy / fx);
if(_root.ship._x < _X)
{
radians -= 1.5707963267948966;
}
else
{
radians += 1.5707963267948966;
}
thrustDX = speed * Math.cos(radians);
thrustDY = speed * Math.sin(radians);
dx = thrustDX;
dy = thrustDY;
}
else
{
dx = 0;
dy = 0;
}
}
else
{
dx = 0;
dy = 0;
}
_X = _X + dx;
_Y = _Y + dy;
if(this.hitTest(_root.ship))
{
depth = _root.getNextHighestDepth();
_root.attachMovie("exp","exp" + depth,depth);
exp = eval("_root.exp" + depth);
exp._x = _X;
exp._y = _Y;
_root.death();
_root.eAmount--;
this.removeMovieClip();
}
if(h <= 0)
{
_root.eAmount--;
_root.points += 300;
_root.eD = _root.eD + 1;
depth = _root.getNextHighestDepth();
_root.attachMovie("exp","exp" + depth,depth);
exp = eval("_root.exp" + depth);
exp._x = _X;
exp._y = _Y;
this.removeMovieClip();
}
}
speed = 5;
h = 10;